package hu.person.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import hu.person.entity.UserInfoEntity;
import hu.person.mapper.UserInfoMapper;
import hu.person.service.UserInfoService;
import hu.person.util.ResponseUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * @Classname TestController
 * @Description TODO
 * @Date 2025/11/5 23:39
 * @Created by 24562
 */
@RestController
@RequestMapping("/test-controller")
@Slf4j
public class TestController {
    @Autowired
    private UserInfoMapper userInfoMapper;

    @Autowired
    private UserInfoService userInfoService;

    @GetMapping("/test-Get")
    public Object test(@RequestParam int pageNum, @RequestParam int pageSize) {
        log.info("this is test controller,time={}", LocalDateTime.now());
        Page<UserInfoEntity> userInfoPage = new Page<>(pageNum,pageSize);
        Page<UserInfoEntity> userInfos = userInfoMapper.selectAll(userInfoPage);
        userInfoService.handleUserInfo();
        return ResponseUtils.sucess(userInfos);
    }
}
